<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>9999</h1>
    <script>
      /**
       * 1到100的和
       */
      let sum = 0;
      for (let i = 1; i <= 100; i++) {
        sum += i;
      }
      console.log(sum);
      /**
       * 1到100的偶数和
       */
      let sum2 = 0;
      for (let i = 1; i <= 100; i++) {
        if (i % 2 == 0) {
          sum2 += i;
        }
      }
      console.log(sum2);
      /**
       * 1到100的奇数和
       */
      let sum3 = 0;
      for (let i = 1; i <= 100; i++) {
        if (i % 2 != 0) {
          sum3 += i;
        }
      }
      console.log(sum3);
      /**
       * 1到100的3的倍数和
       */
      let sum4 = 0;
      for (let i = 1; i <= 100; i++) {
        if (i % 3 == 0) {
          sum4 += i;
        }
      }
      console.log(sum4);
    </script>
  </body>
</html>
